<?php
/**
 * User: WL
 * Time: 12-10-13 - 上午9:14
 * File: list.inc.php
 * Project For ixdcw.com
 */
/**
 * 2013-4-1 Sameal add order by cityid an group level
 */
defined('IN_IXDCW') or exit('Access Denied');
require DT_CORE.'/buyhelp/common.inc.php';

$condition = 'status =3';
$car_condition = 'status =3';
if (!empty($cartypeid)) {
	$order.= "(case when  cartypeid={$cartypeid} then 1 else 2 end),edittime desc";
	$carids = AutoCategoryModule::getCarbylevel($cartypeid);
	$car_order .= "(case when arcid in ($carids) then 1 else 2 end),edittime desc";
}

//新车谍照
$picList = $db->getAll("select title,thumb,itemid from {$db->getPre()}information where $condition and catid=2562 and thumb!='' order by {$order} limit 8");
//幻灯图片
$picList_left =$picList = $db->getAll("select title,thumb,itemid from {$db->getPre()}information where $condition and catid in (2562,2563,2564) and level=2 order by {$order} limit 8");
//国产新车
$gList = $db->getAll("select title,itemid,edittime from {$db->getPre()}information where $condition and catid=2563 order by {$order} limit 10");
//进口新车
$jList = $db->getAll("select title,itemid,edittime from {$db->getPre()}information where $condition  and catid=2564 order by {$order} limit 10");
//导购
$guideList_pic = $db->getAll("select title,itemid,thumb from {$db->getPre()}guide where $car_condition and thumb!='' order by {$car_order} limit 2");
$guideList = $db->getAll("select title,itemid,edittime from {$db->getPre()}guide where $car_condition order by {$car_order} limit 2,24");
$guideList_left = array_splice($guideList,0,11);
//行情
$quoteList = $db->getAll("select title,itemid,edittime from {$db->getPre()}quote where $car_condition order by {$car_order} limit 10");
//试驾
$driveList = $db->getAll("select title,itemid,edittime from {$db->getPre()}guide where $car_condition and catid=3592 order by {$car_order} limit 10");
//降价
$priceList = $db->getAll("select title,itemid,edittime from {$db->getPre()}price where $car_condition  order by {$car_order} limit 10");
//车贷
$loanList  = $db->getAll("select title,itemid,edittime from {$db->getPre()}information where status=3 and catid=5153 order by {$order} limit 10");
//二手车
$buy_cat_choose = get_cat(4960);
$buyList   = $db->getAll("select title,itemid,thumb,price from {$db->getPre()}buy where status=3  and thumb!=''  and catid in ('".$buy_cat_choose['arrchildid']."') order by {$car_order} limit 12");
//汽车批发
$saleList=$db->getAll("select * from {$db->getPre()}auto_sale where status=3 order by addtime desc limit 12");
//汽车车险
$insurancelist=$db->getAll("select * from {$db->getPre()}auto_insurance where 1=1 order by add_time desc limit 12");
//经销商
if($cityid){$inArea = "order by (case when company_areaid in (".$AREA[$cityid]["arrchildid"].") then 1 else 2 end) ";}
$comList = $db->getAll("select d.did,d.title,d.company_business,d.company_telephone from {$db->getPre()}merchant_doc d,{$db->getPre()}merchant_catid c where d.did=c.did  and c.catid=3841 and d.company_telephone!=''  GROUP BY  d.did $inArea limit 10");

$MOD['name']='买车助手';
$seo_file = 'index';
include DT_INC.'/seo.inc.php';
include template('index', 'buyhelp');

